﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AcademicPlanControl.ascx.cs" Inherits="AcademicPlanner.Presentation.Views.Shared.AcademicPlanControl" %>
<%@ Import Namespace="AcademicPlanner.Framework.Helpers" %>
<%@ Import Namespace="AcademicPlanner.Presentation" %>
<%@ Import Namespace="AcademicPlanner.Presentation.Views.Shared" %>
<%@ Import Namespace="AcademicPlanner.Domain.Models" %>


<% if (!Model.IsSub)
   { %>
	<div class="academic-plan-control yui-skin-sam" id="<%= Model.Id %>" cPlanFormUrl="<%= Url.Action("AcademicPlanForm", 
		"Controls", 
		new { pScenario = AcademicPlanFormScenario.EDIT,
				pAcademicPlanId = Model.AcademicPlan.EntityId }) %>" cSelfUrl="<%= Url.Action("AcademicPlanControl", 
		"Controls",
		new { pAcademicPlanId = Model.AcademicPlan.EntityId, pHtmlId = Model.Id }) %>">
		<h3>
			<%= Html.Encode(Title) %>
			<span class="right">
				<%= WidgetHelper.ActionsSideMenu("actOnAcademicPlan", Tr("Actions"), ActionsSideMenuOptions) %>
			</span>
		</h3>
<% } %>
		
<div class="academicplan-view-body rows-wrapper">
	<div class="row">
		<div class="cell label">
			<%= Html.Label("", Html.Encode(Tr(Labels.Get("CreditUnits", "AcademicPlan"))))%>
		</div>
		<div class="cell">
			<%= Model.AcademicPlan.CreditUnits %>
		</div>
	</div>
	<div class="row">
		<div class="cell label">
			<%= Html.Label("", Html.Encode(Tr(Labels.Get("Terms", "AcademicPlan"))))%>
		</div>
		<div class="cell">
			<%
				var vTerms = Model.AcademicPlan.Terms.ToList();
				var vTermNames = new string[vTerms.Count];
				for (var vI = 0; vI < vTermNames.Length; vI++)
				{
					vTermNames[vI] = vTerms[vI].Name;
				}	
			%>
			<%= Html.Encode(string.Join(", ", vTermNames)) %>
		</div>
	</div>
	<div class="row">
		<div class="cell label">
			<%= Html.Label("", Html.Encode(Tr(Labels.Get("Divisions", "AcademicPlan"))))%>
		</div>
		<% foreach (var vDivision in Model.AcademicPlan.Divisions.ToList())
		{ %>
			<div class="cell right-separator thick-border left">
				<div class="row">
					<%= Html.Encode(vDivision.Name) %>
				</div>
				<% foreach (var vCategory in vDivision.Categories.ToList())
				{ %>
					<div class="row">
						<div class="cell">
							<%= Html.Encode(vCategory.Name) %> (<%= Html.Encode(vCategory.Code) %>)
						</div>
					</div>
				<% } %>
			</div>
		<% } %>
	</div>
</div>
<script type="text/javascript">
	gDomReadyQueue.push('gAcademicPlanControlCtrl.registerWithHistory("<%= Model.Id %>");');
	gHistoryReadyQueue.push('gAcademicPlanControlCtrl.initForHistory("<%= Model.Id %>");');
</script>
	
<% if (!Model.IsSub)
   { %>
		</div>
<% } %>